package com.spsoft.core.annotation;




import com.spsoft.core.validation.EnumClassValueValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 *  验证固定枚举类的值注解
 * @author: cdl
 * @create: 2022/6/30 12:53
 **/
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER})
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = {EnumClassValueValidator.class})
public @interface EnumClassValue {

    /**默认错误消息 **/
    String message() default "必须为指定值";

    /** 枚举类 **/
    Class<? extends Enum<?>> clazz() ;
    /** 枚举的值，默认code**/
    String fieldValue() default "code";
    //分组
    Class<?>[] groups() default {};

    //负载
    Class<? extends Payload>[] payload() default {};

}

